package com.example.wangyuyuan.androidframe.myApplication;

import android.app.Activity;
import android.app.Application;
import android.content.Context;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;

import com.blankj.utilcode.util.Utils;
import com.example.wangyuyuan.androidframe.manager.ActivityStack;
import com.example.wangyuyuan.androidframe.mvp.base.BaseActivity;


/**
 * Created by wangyuyuan on 2017/5/9.
 * 程序在启动时会创建一个Application，相当于系统的四大组建一样，
 * 从程序启东市Application就创建，直到程序退出，可以说Application的生命周期就是程序的生命周期
 * 我们只需要在mannifest中添加一个name属性将Application应用进去就可以
 */

public class MyApplication extends Application {
    /**
     * 应用实例
     */
    public static MyApplication application;

    /**
     * 上下文
     */
//    public static Context context;
//
//    private static Thread mMainThread;//主线程
//    private static long mMainThreadId;//主线程id
//    private static Looper mMainLooper;//循环队列
//    private static Handler mHandler;//主线程Handler

    @Override
    public void onCreate() {
        super.onCreate();
        application = this;
//        context = getApplicationContext();
//        mMainThread = Thread.currentThread();
//        mMainThreadId = android.os.Process.myTid();
//        mHandler = new Handler();
        Utils.init(application);//初始化第三方库
    }

    /**
     * 获取实例
     */
    public static MyApplication getApplication() {
        return application;
    }

    /**
     * 返回上下文对象
//     */
//    public static Context getContext() {
//        return context;
//    }
//
//    public static void setContext(Context mContext) {
//        MyApplication.context = context;
//    }
//
//    public static Thread getMainThread() {
//        return mMainThread;
//    }
//
//    public static void setMainThread(Thread mMainThread) {
//        MyApplication.mMainThread = mMainThread;
//    }
//
//    public static long getMainThreadId() {
//        return mMainThreadId;
//    }
//
//    public static void setMainThreadId(long mMainThreadId) {
//        MyApplication.mMainThreadId = mMainThreadId;
//    }
//
//    public static Looper getMainThreadLooper() {
//        return mMainLooper;
//    }
//
//    public static void setMainThreadLooper(Looper mMainLooper) {
//        MyApplication.mMainLooper = mMainLooper;
//    }
//
//    public static Handler getMainHandler() {
//        return mHandler;
//    }
//
//    public static void setMainHandler(Handler mHandler) {
//        MyApplication.mHandler = mHandler;
//    }

}
